home *** CD-ROM | disk | FTP | other *** search
- From: clamage@Eng.Sun.COM (Steve Clamage)
- Message-ID: <4epod1$qth@engnews1.Eng.Sun.COM>
- X-Original-Date: 1 Feb 1996 06:59:45 GMT
- Path: in1.uu.net!bounce-back
- Date: 01 Feb 96 13:18:50 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: When can definitions of library functions be provided by a program?
- Organization: Sun Microsystems Inc., Mountain View, CA
- References: <DM2Bv9.C7p@scr.siemens.com>
- X-Newsreader: NN version 6.5.0 #21 (NOV)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMRC92uEDnX0m9pzZAQE67AF/ZWmecW/HPW/Rwir41ByvGcDm6QH2svi1
- XyqjuS+F9HgiVvhA7PbaOPIvMr0WyGn9
- =LPat
-
- mlg@scr.siemens.com (Michael Greenberg) writes:
-
- >I'm trying to figure out under what circumstances a program can supply
- >a definition for a library function. Is it the case that a program
- >cannot supply a definition for any library function except for those
- >listed in 17.3.3.4 (new & delete with various signatures)?
-
- That is correct. You cannot extend the "std" namespace, and the names
- of the library functions are reserved except as noted.
-
- The reason for the rule is to ensure 3rd-party libraries, and indeed the
- implementation-supplied runtime library, can depend on the operation
- of the standard functions. If you were allowed to replace them, there
- could be no guarantees. (It also allows implementors maximum
- freedom in implementing the library, since replacing functions
- need not be considered.)
-
- Example: A program used in religious education has a function that
- analyzes answers to moral questions via an index and determines the
- degree of "sin" involved. If the function were called "sin", that
- could create havoc in other parts of the program that attempted to do
- trigonometric calculations.
-
- The rule does not mean an implementation must prevent you from
- trying to replace library functions. Indeed, it is often
- possible to do so for selected functions. You just cannot depend
- on being able to do it, particularly in portable code. Such a
- program might not compile, might compile but not link, might
- link but not run correctly.
-
- >(As an aside, what's the 'C' standard have to say about this?)
-
- No functions in the C library may be replaced. All the names are
- reserved.
- --
- Steve Clamage, stephen.clamage@eng.sun.com
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-